//
//  ThreeCollectionViewCell.m
//  Music
//
//  Created by dllo on 16/6/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ThreeCollectionViewCell.h"

@implementation ThreeCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.picUrl = [[UIImageView  alloc] init];
        [self.contentView  addSubview:_picUrl];
        
        self.name = [[UILabel  alloc] init];
        self.name.font =[UIFont  fontWithName:@"Helvetica-Oblique" size:14];
        [self.contentView  addSubview:_name];
        
        self.desc = [[UILabel  alloc] init];
        self.desc.font =[UIFont  fontWithName:@"Helvetica-Oblique" size:12];
        [self.contentView  addSubview:_desc];
    }
    
    return self;
}
-(void)layoutSubviews
{
    [super  layoutSubviews];
    
    self.picUrl.frame = CGRectMake(0,0 ,(Screenwidth-26)/3 , (Screenwidth-26)/3-20);
    self.name.frame = CGRectMake(self.picUrl.frame.origin.x, self.picUrl.frame.origin.y+self.picUrl.frame.size.height, self.picUrl.frame.size.width, 30);
    self.desc.frame = CGRectMake(self.name.frame.origin.x, self.name.frame.size.height+self.name.frame.origin.y, self.name.frame.size.width, 10);
    
}
-(void)setModel:(smallModel *)model
{
    if (_model != model) {
        _model = model;
    }
    [self.picUrl  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    
    self.name.text = model.name;
    self.desc.text = model.desc;
   
    
}




@end
